<?php
$oJob = JobHandler::getCurrentJob();
$oUsers = UserHandler::getUsers();
$oUserAccess = JobHandler::getUserAccess($_SESSION['iJobID']);
$oAccess = $oUserAccess[$_REQUEST['iUser']];
?>
<div id="layer_job_userchange" class="hidden" style="visibility: visible;">
<form action="index.php" method="post" name="form_job_userchange">
<input type="hidden" name="sAction" value="job-setaccess">
<input type="hidden" name="sView" value="job-view">
<input type="hidden" name="iUser" value="<?php print $_REQUEST['iUser'] ?>">
<input type="hidden" name="oAccess[job-read]" value="1">
<table class="boxborder" cellspacing="0">
	<tr>
		<td class="boxhandle" colspan="2"><?php print msg('Change access') ?></td>
	</tr>
	<tr>
		<td class="fieldname"><?php print msg('User') ?>:</td>
		<td class="fieldvalue"><input type="text" name="sUser" value="<?php print $oUsers[$_REQUEST['iUser']]->sUser ?>" disabled></td>
	</tr>
	<tr id="job_userchange_moreaccess">
		<td class="clear" colspan="2">
			<table cellspacing="0" style="width: 100%;">
				<tr>
					<td class="separator" colspan="2"><?php print msg('Access') ?></td>
				</tr>
				<tr>
					<td class="fieldname"><?php print msg('Project') ?>:</td>
					<td class="fieldvalue">
						<input type="checkbox" id="job_userchange_job_write" value="1" name="oAccess[job-write]" <?php print ($oAccess['job']['write'] ? 'checked' : '') ?>> <?php print msg('Write') ?>
					</td>
				</tr>
				<tr>
					<td class="fieldname"><?php print msg('Tasks') ?>:</td>
					<td class="fieldvalue">
						<input type="checkbox" id="job_userchange_mission_read" value="1" name="oAccess[mission-read]" <?php print ($oAccess['mission']['read'] ? 'checked' : '') ?>> <?php print msg('Read') ?>
						<input type="checkbox" id="job_userchange_mission_write" value="1" name="oAccess[mission-write]" <?php print ($oAccess['mission']['write'] ? 'checked' : '') ?>> <?php print msg('Write') ?>
					</td>
				</tr>
				<tr>
					<td class="fieldname"><?php print msg('Files') ?>:</td>
					<td class="fieldvalue">
						<input type="checkbox" id="job_userchange_file_read" value="1" name="oAccess[file-read]" <?php print ($oAccess['file']['read'] ? 'checked' : '') ?>> <?php print msg('Read') ?>
						<input type="checkbox" id="job_userchange_file_write" value="1" name="oAccess[file-write]" <?php print ($oAccess['file']['write'] ? 'checked' : '') ?>> <?php print msg('Write') ?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td class="boxbody" style="text-align: center;" colspan="2">
<?php
if ($oJob->iOwner == $_SESSION['rid']) {
	print '<input type="button" value="'.('Make owner').'" onClick="location.href = \'index.php?sView=job-view&sAction=job-setowner&iUser='.$_REQUEST['iUser'].'\';">';
}
?>
			<input type="submit" value="<?php print msg('OK') ?>">
			<input type="button" value="<?php print msg('Cancel') ?>" onClick="showBox('job-access');">
		</td>
	</tr>
</table>
</form>
</div>
